home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cnews007.zip / NEWSFILE.ZIP / CLS.ASM next >
Assembly Source File  |  1988-04-30  |  1KB  |  36 lines

  1. ;-----------------------------------------------------------------------;
  2. ; FAST_CLS Library procedure to be called from TURBO C            ;
  3. ; This procedure clears the screen by writing zeros directly into the   ;
  4. ; screen buffer on the the video adapter defined in variable "vid_mem". ;
  5. ; This is the fastest way to clear the screen, although it useful only  ;
  6. ; when in non-text graphics mode.                    ;
  7. ;-----------------------------------------------------------------------;
  8.  
  9.     PUBLIC    _FAST_CLS
  10.     NAME    FAST_CLS
  11. _TEXT    SEGMENT    BYTE    PUBLIC    'CODE'
  12.     ASSUME    CS:_TEXT
  13.  
  14. VID_MEM        EQU    0B000h        ; Segment for MONO display adapter
  15.                     ; change for your display type
  16.                     ; CGA = 0B800h
  17. ;-----------------------------------------------------------------------;
  18. _FAST_CLS    PROC    NEAR
  19.         PUSH    BP        ; Save the BP register
  20.         MOV    BP,SP         ; Make BP point to top of stack
  21.     
  22.         MOV    AX,VID_MEM    ; Point to mono display
  23.         MOV    ES,AX        ; Source = video adapter
  24.         MOV    DI,0        ; Destination = upper left corner
  25.         MOV    AX,0        ; Will fill buffer with zeros
  26.         MOV    CX,2000        ; Number of characters to write
  27.         REP    STOSW        ; Fill screen buffer fast!
  28.         POP    BP        ; Restore BP register
  29.         RET            ; Return to calling program
  30. _FAST_CLS    ENDP
  31. ;-----------------------------------------------------------------------;
  32.  
  33. _TEXT        ENDS
  34.         END
  35.         
  36.